<html>
<head>
<title>Page d'ajout adh�rant</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="<?php echo base_url();?>css/stylesheet.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready( function () {
	$("#go").click(function(){
		var id_clinique = $("#id_clinique").val();
		var email = $("#email").val();
		var mdp = $("#mdp").val();
		var pays = $("#pays").val();
		var map = $("#map").val();
		var ville = $("#ville").val();
		var nomville = $("#nomville").val();
		var adresse = $("#adresse").val();
		var code_postal = $("#code_postal").val();
		var nom_clinique = $("#nom_clinique").val();
		var surface = $("#surface").val();
		var fauteuil = $("#fauteuil").val();
		var scanner = $("#scanner").val();
		var prothese = $("#prothese").val();
		var marque_implant1 = $("#marque_implant1").val();
		var marque_implant2 = $("#marque_implant2").val();
		var marque_implant3 = $("#marque_implant3").val();
		var origine_materiaux1 = $("#origine_materiaux1").val();
		var origine_materiaux2 = $("#origine_materiaux2").val();
		var origine_materiaux3 = $("#origine_materiaux3").val();
		if (id_clinique != ""){
			$.post("<?php echo base_url();?>index.php/admin/updateInfoClinique", {email:email, mdp:mdp, pays:pays, map:map, ville:ville, adresse:adresse, code_postal:code_postal, nom_clinique:nom_clinique,surface:surface, fauteuil:fauteuil, scanner:scanner, prothese:prothese,marque_implant1:marque_implant1, marque_implant2:marque_implant2, marque_implant3:marque_implant3, origine_materiaux1:origine_materiaux1, origine_materiaux2:origine_materiaux2, origine_materiaux3:origine_materiaux3, nomville:nomville, id_clinique:id_clinique},				
					function(data){
						//alert("enregistr�");
						window.close();
					}
				);
			
		}
	});
	$("#fermer").click(function(){
		window.close();
	});

});
</script>
<script>
function supprimerLogo(identification){
	var id_clinique = $("#id_clinique").val();
	var url = "<?php echo base_url();?>index.php/admin/supprimerLogoClinic?identification="+id_clinique;
		if(window.confirm("Voulez-vous vraiment supprimer cette image?")){	
			$.post(url, {identification : identification},				
			function(data){
				var urlredirect = "<?php echo base_url(); ?>index.php/admin/infoGalImage?id="+id_clinique;
				document.location = urlredirect;
			}
		);
	}	
}
function supprimerImgPpl(identification){
	var id_clinique = $("#id_clinique").val();
	var url = "<?php echo base_url();?>index.php/admin/supprimerImgPplClinic?identification="+id_clinique;
		if(window.confirm("Voulez-vous vraiment supprimer cette image?")){	
			$.post(url, {identification : identification},				
			function(data){
				var urlredirect = "<?php echo base_url(); ?>index.php/admin/infoGalImage?id="+id_clinique;
				document.location = urlredirect;
			}
		);
	}	
}
function supprimerGalImg(identification){
	var id_clinique = $("#id_clinique").val();
	var url = "<?php echo base_url();?>index.php/admin/supprimerGalImageClinic?identification="+identification;
		if(window.confirm("Voulez-vous vraiment supprimer cette image?")){	
			$.post(url, {identification : identification},				
			function(data){
				var urlredirect = "<?php echo base_url(); ?>index.php/admin/infoGalImage?id="+id_clinique;
				document.location = urlredirect;
			}
		);
	}	
}
function supprimerPhotoSoin(identification){
	var id_clinique = $("#id_clinique").val();
	var url = "<?php echo base_url();?>index.php/admin/supprimerPhotoSoinClinic?identification="+identification;
		if(window.confirm("Voulez-vous vraiment supprimer cette image?")){	
			$.post(url, {identification : identification},				
			function(data){
				var urlredirect = "<?php echo base_url(); ?>index.php/admin/infoGalImage?id="+id_clinique;
				document.location = urlredirect;
			}
		);
	}	
}
</script>
<style>
.fixedimage{
	max-height: 100px;
	width:50px;
}
</style>
</head>
<body>
<input type="hidden" name="id_clinique" id="id_clinique" value="<?php echo $id_clinique; ?>" />
<div>
<table width="100%" border="0" cellspacing="5" cellpadding="0" style="font-size:14px;">  
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>Logo et image principale </h2></legend>
		<?php
 		foreach ($result1 as $key => $list1){	
        ?>
		<table>
			<?php
			if($list1['logo'] != ""){
			?>
			<tr>
			    <td>
			    	<img src="<?php echo base_url(); ?>upload/<?php echo $list1['logo'];?>" alt="" class='fixedimage' id="imagelogo">
			    </td>
			    <td><input type="button" value="Supprimer" onclick="supprimerLogo('<?php echo $id_clinique; ?>')" />
				</td>
			</tr>
			<?php
			}
			?>
			<?php
			if($list1['image_principale'] != ""){
			?>
			<tr>
			    <td>
			    	<img src="<?php echo base_url(); ?>upload/<?php echo $list1['image_principale'];?>" alt="" class='fixedimage' id="imgPpl">
			    </td>
			    <td><input type="button" value="Supprimer" onclick="supprimerImgPpl('<?php echo $id_clinique; ?>')" />
				</td>
			</tr>
			<?php
			}
			?>
		</table>
		<?php
		}		
		?>
	</fieldset>
	</td>
</tr>
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>Gal&eacute;rie d'images </h2></legend>
		<?php
 		foreach ($result2 as $key => $list2){		
		?>
		<table>
			<tr>
			    <td>
			    	<img id="im_<?php echo $list2['id_galerieImage']?>" src="<?php echo base_url(); ?>upload/<?php echo $list2['image'];?>" class='fixedimage' alt="">
			    </td>
				<td><input type="button" value="Supprimer" onclick="supprimerGalImg('<?php echo $list2['id_galerieImage']?>')" />
				</td>
			</tr>
		</table>
		<?php
       }		
      ?>
	</fieldset>
	</td>
</tr>
<tr>
	<td colspan="2">
	<fieldset>
		<legend><h2>Photo des soins </h2></legend>
		<?php
 		foreach ($result3 as $key => $list3){		
		?>
		<table>
			<tr>
			    <td>
			    	<img id="im2_<?php echo $list3['id_photoSoin']?>" src="<?php echo base_url(); ?>upload/<?php echo $list3['imageSoin'];?>" class='fixedimage' alt="">
			    </td>
			    <td><input type="button" value="Supprimer" onclick="supprimerPhotoSoin('<?php echo $list3['id_photoSoin']?>')" />
				</td>
			</tr>
		</table>
		<?php
       }		
      ?>
	</fieldset>
	</td>
</tr>
</table>    
<div style="float:center">
		<input type="submit" name="submit" id="go" value="Enregistrer modifications" />
		<input type="button" name="button" id="fermer" value="Fermer" />
</div>
</div>
</body>
</html>